import {ref} from 'vue'
import PageDialog from '@/components/page-dialog/PageDialog.vue'
export default function useDialog(createCb?:() => void,editeCb?:() => void) {
  const pageDialogRef = ref<any>()
  const editeData = ref({})

  const handleCreateClick:any = () => {
    editeData.value = {};
    (pageDialogRef.value as any).changeIsShowDialog()
    createCb && createCb()
  }
  const handleEditeClick:any = (info:any) => {
    editeData.value = { ...info }
    
    pageDialogRef.value?.changeIsShowDialog()
    
    editeCb && editeCb()
  }
  return [
    pageDialogRef,
    editeData,
    handleCreateClick,
    handleEditeClick
  ]
}